import { request } from './request'

// 时间段管理 API
const timePeriodAPI = {
  // 查询时间段列表
  list: (params) => {
    return request('/venue/time-period/list', {
      method: 'POST',
      body: params
    })
  },

  // 根据日期查询可预约时间段
  listTimePeriodByDate: (params) => {
    return request('/venue/time-period/listTimePeriodByDate', {
      method: 'POST',
      body: params
    })
  },

  // 获取时间段日期和时间段映射
  getPeriodDateAndTimePeriodMap: (params) => {
    return request('/venue/time-period/getPeriodDateAndTimePeriodMap', {
      method: 'POST',
      body: params
    })
  },

  // 预约时间段 v1
  reserveV1: (reserveData) => {
    return request('/venue/time-period/v1/reserve', {
      method: 'POST',
      body: reserveData
    })
  },

  // 预约时间段 v2
  reserveV2: (reserveData) => {
    return request('/venue/time-period/v2/reserve', {
      method: 'POST',
      body: reserveData
    })
  },

  // 释放时间段
  release: (releaseData) => {
    return request('/venue/time-period/v1/release', {
      method: 'POST',
      body: releaseData
    })
  },

  // 根据ID获取时间段
  getById: (id) => {
    return request(`/venue/time-period/getById/${id}`)
  },

  // 批量删除时间段
  removeByIds: (ids) => {
    return request('/venue/time-period/removeByIds', {
      method: 'POST',
      body: ids
    })
  },

  // 根据ID删除时间段
  removeById: (id) => {
    return request('/venue/time-period/removeById', {
      method: 'POST',
      body: { id }
    })
  }
}

export { timePeriodAPI }